agent: Scheduled actions have been reported to be crashing the page for some ac#1568
agent: Scheduled actions have been reported to be crashing the page for some ac#1568sweetmantech wants to merge 1 commit intotestfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughFour files updated to add null/undefined safety checks for task schedule handling. Guard clauses and fallback values prevent errors when schedule values are empty or undefined. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/VercelChat/tools/tasks/TaskCard.tsx`:
- Around line 81-85: Normalize task.schedule once into a single variable (e.g.,
const normalizedSchedule = task.schedule?.trim()) and use that
normalizedSchedule for both the isRecurring check and the label rendering: call
isRecurring(normalizedSchedule) for the Repeat icon and pass normalizedSchedule
to parseCronToHuman (or show "No schedule" if falsy). Update references to
task.schedule in this block so both the icon and text operate on the same
trimmed value.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 520631ab-d4c4-4245-aa90-d4d9b8d09d9f
📒 Files selected for processing (4)
components/VercelChat/dialogs/tasks/TaskDetailsDialogContent.tsxcomponents/VercelChat/tools/tasks/TaskCard.tsxlib/tasks/isRecurring.tslib/tasks/parseCronToHuman.ts
| {task.schedule && isRecurring(task.schedule) && ( | ||
| <Repeat className="h-4 w-4 text-muted-foreground dark:text-muted-foreground flex-shrink-0" /> | ||
| )} | ||
| <span className="text-base text-muted-foreground dark:text-muted-foreground"> | ||
| {parseCronToHuman(task.schedule.trim())} | ||
| {task.schedule ? parseCronToHuman(task.schedule.trim()) : "No schedule"} |
There was a problem hiding this comment.
Normalize the schedule once before both checks.
The label uses task.schedule.trim(), but the Repeat icon still reads the raw value. If a saved cron has extra whitespace, the text and icon can disagree. Reuse one normalized value for both branches.
♻️ Proposed fix
const TaskCard: React.FC<TaskCardProps> = ({ task, isDeleted, ownerEmail }) => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const { updateAction, isLoading: isUpdating } = useUpdateScheduledAction();
const { deleteAction, isLoading: isDeleting } = useDeleteScheduledAction();
const isActive = task.enabled && !isDeleted;
const isPaused = !task.enabled && !isDeleted;
+ const normalizedSchedule = task.schedule?.trim() || "";
const handlePause = async (e: React.MouseEvent) => {
@@
- {task.schedule && isRecurring(task.schedule) && (
+ {normalizedSchedule && isRecurring(normalizedSchedule) && (
<Repeat className="h-4 w-4 text-muted-foreground dark:text-muted-foreground flex-shrink-0" />
)}
<span className="text-base text-muted-foreground dark:text-muted-foreground">
- {task.schedule ? parseCronToHuman(task.schedule.trim()) : "No schedule"}
+ {normalizedSchedule ? parseCronToHuman(normalizedSchedule) : "No schedule"}
</span>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@components/VercelChat/tools/tasks/TaskCard.tsx` around lines 81 - 85,
Normalize task.schedule once into a single variable (e.g., const
normalizedSchedule = task.schedule?.trim()) and use that normalizedSchedule for
both the isRecurring check and the label rendering: call
isRecurring(normalizedSchedule) for the Repeat icon and pass normalizedSchedule
to parseCronToHuman (or show "No schedule" if falsy). Update references to
task.schedule in this block so both the icon and text operate on the same
trimmed value.
Automated PR from coding agent.
Prompt: Scheduled actions have been reported to be crashing the page for some accounts. Can you debug why and open a pr fixing any bugs on the /tasks page in Chat. make sure to push your changes and open a pr.
Summary by CodeRabbit